/*   Shotscreens
 *   Copyright (C) 2010, Vadim Zakondyrin (http://crystalnix.com)
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef HttpSystem_H
#define HttpSystem_H

#include "../../pluginSDK/UploaderInterface.h"
#include <QNetworkReply>
#include <shotscreenswebapi.h>
//#include <QSettings>
#include <settingswindow.h>
#include <QMessageBox>
#include <QInputDialog>
#include <imageproperty.h>

class HttpSystem : public QObject, public UploaderInterface
{
    Q_OBJECT
    Q_INTERFACES(UploaderInterface)
private:
    typedef struct
    {
        QString session_id;
        QString user_login;
        QString user_password;
     } SECURITY_INFO;

public:
    HttpSystem(QObject *parent = 0);
  /*  bool uploadMemory(const QByteArray &data);
    bool ShowOptions();
    bool ShowAbout();
    bool uploadFile(const QString &) { return true; }
    bool GetPluginVersion(int &version, int &subversion);
    bool saveSettings(QSettings *) { return true; }
    bool loadSettings(const QSettings *) { return true; }

    void setLoginAndPassword(const QString &login, const QString &password);

    inline QString getLogin() const { return login; }
    inline QString getPassword() const { return password; }
    inline QString getNameOfService() const { return nameOfService; }*/
    void GetPluginVersion(int &version,int &subversion);
    void SetLoginAndPassword(QString login, QString password);
    void GetPluginName(QString &dest_buffer);
    //void GetPluginThumbnail(QIcon &dest_icon);
    bool UploadStream(QByteArray &streamData);
    bool UploadFile(QString fileName);
    void ShowOptions(QDialog* settingsWindowDraft);

private:
    SECURITY_INFO sec_info;



    QString login;
    QString password;
    QString nameOfService;
    QNetworkAccessManager *network_manager;
    ShotScreensWebAPI *my_api;
    QByteArray image_data;
    QByteArray bytes;
    //QSettings settings;
    SettingsWindow settingsWindow;

    QMessageBox MessageBox;


    ImageProperty imageProperty;

private slots:
    void OnFinish (bool result);



};

#endif // HttpSystem_H
